#ifndef GUIDETABLE2_H
#define GUIDETABLE2_H


#include <QWidget>
#include <QProxyStyle>
#include <QPainter>
#include <QStyleOptionTab>
#include "xlsxdocument.h"
#include <QDebug>
#include <dbHelper.h>
#include <QFileDialog>
#include <QTableWidget>
#include <QLabel>
#include <QHBoxLayout>
#include "pcrState.h"
#include <QHeaderView>
#include <QFontDatabase>

#include "labelResultWarningInfo.h"

extern QStringList     STRType;
extern QStringList     STRName;
extern QStringList     STRsys;

class GuideTable2 : public QWidget
{
    Q_OBJECT
public:
    GuideTable2(QWidget* parent=nullptr);

    void init(PCRState *state);

    void on_sum_clicked();

    void on_CSTR_clicked();

    void on_YSTR_clicked();

    void on_miniSTR_clicked();

    void on_dilute_clicked();

    void save(QString filePath);

    QTableWidget* getTable1();
    QTableWidget* getTable2();

private slots:
    void on_filterChanged();
    void on_guidePageChanged();
    void on_pageChanged();

private:
    void showEvent(QShowEvent *event=nullptr) override;
    void resizeEvent(QResizeEvent *event) override;

    void fixRow();
    void resizeRow();

    void createXlsx(QXlsx::Document &xlsx);




public:
    QTableWidget*   _table_data = nullptr;
    QTableWidget*   _table_plan = nullptr;
    PCRState*       pState;
    QVBoxLayout*    _layout;
    QWidget*        _widget_text;
    QHBoxLayout*    _layout_text;

    QLabel*         _label_Y;
    QLabel*         _label_AL;
    QLabel*         _label_AS;

    QTableWidget*   _table0;



    QTableWidget*   _printTable1 = nullptr;
    QTableWidget*   _printTable2 = nullptr;


private:

    void tab1();
    void datain();
    QStringList bzend,fbzend,vaend;
    QList<int> bzed,fbzed;
    int q5fl;
    void datacu(int row, double famn, double vicn, double roxn, double cqv, double cqbz);
    void tab2();
    void dataca(int row, double ICS, double DI, double AL, double AS, double Y);
    bool YSTRfl=false;
    bool miniSTRfl=false;
    void xsui(int row, QString type, int tx);
    void tab2xh();
    int ynum;
    int tabifl=1;
};

#endif // GUIDETABLE2_H
